home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ansi / sdsgnr.zip / SHOWSCR.C < prev    next >
Text File  |  1991-08-09  |  4KB  |  105 lines

  1.  
  2. /*  Example of how to use screens saved as C source in your C program */
  3.  
  4. /*
  5.     This was compiled and tested with Turbo C 2.0, but should not
  6.     require much changes for Quick C.
  7.  
  8. */
  9.  
  10. /*-------------------------------------------------------------------*/
  11.  
  12. #include <bios.h>
  13. #include <conio.h>
  14.  
  15. #define COLORVIDEO  0xb800
  16. #define SCRSIZE       4000
  17.  
  18. unsigned GLOBAL_videobase = COLORVIDEO;
  19.  
  20. /*-------------------------------------------------------------------*/
  21.  
  22. void showscreen (int screen[], int size, int vidmode)
  23. {
  24.   int c;
  25.   unsigned ofs, i, j, reps;
  26.  
  27.     ofs = 0;
  28.     j = 0;
  29.  
  30.     if (vidmode == 40) {
  31.            textmode(C40);
  32.     }
  33.     else {
  34.            textmode(C80);
  35.     }
  36.  
  37.     while (ofs < SCRSIZE && j < size) {
  38.        c = screen[j++];
  39.        if (c != 0) {
  40.            poke(GLOBAL_videobase,ofs,c);
  41.            ofs += 2;
  42.        }
  43.        else {
  44.            c = screen[j++];
  45.            reps = screen[j++];
  46.            reps = 2 * reps + ofs;
  47.            for (i = ofs; i < reps; i += 2) {
  48.                 poke(GLOBAL_videobase,i,c);
  49.            }
  50.            ofs = i;
  51.        }
  52.     }
  53. }
  54. /*-------------------------------------------------------------------*/
  55.  
  56. main()
  57. {
  58.     /*
  59.         After you create your screen with SD.EXE and save it as a
  60.         C source file, merge it into your program as follows:
  61.     */
  62.    int EXAMPLE_vidmode = 80;
  63.    unsigned EXAMPLE_scr[] = {
  64.       28361,0,28365,78,28347,28346,0,28192,78,28346,28346,0,28192,4,12762,0,12740,29,12735,
  65.      0,28192,43,28346,28346,0,28192,4,12723,12633,12623,12629,12626,12576,12622,
  66.      12609,12621,12613,12602,12576,12576,0,12720,17,12723,0,28192,43,28346,28346,0,28192,4,
  67.      12736,0,12740,29,12761,0,28192,43,28346,28346,0,28192,20,25632,0,28192,43,-12512,-12457,
  68.      -12479,-12462,-12466,-12471,-12466,-12473,-12512,0,28192,5,28346,28346,0,28192,26,
  69.      28361,0,28365,21,28347,0,28192,16,12250,0,12228,5,12223,0,28192,6,28346,28346,0,28192,26,
  70.      28346,0,28192,21,28346,0,28192,16,12211,12064,12064,12228,12223,12089,12211,
  71.      0,28192,6,28346,28346,0,28192,26,28346,28192,28192,32544,-187,-168,-191,-179,
  72.      -176,-180,-187,-224,-173,-189,-174,-187,-187,-178,-224,
  73.      28192,28192,28192,28346,0,28192,16,12211,12064,12064,12228,12212,12088,12211,0,28192,6,
  74.      28346,28346,0,28192,26,28346,0,28192,21,28346,0,28192,16,12211,12064,12064,12228,12212,
  75.      12087,12211,0,28192,6,28346,28346,0,28192,26,28346,0,28192,21,28346,0,28192,16,12211,
  76.      12228,12048,12228,12212,12086,12211,0,28192,6,28346,28346,0,28192,26,28360,
  77.      0,28365,21,28348,0,28192,16,12211,12064,12064,12228,12212,12085,12211,0,28192,6,
  78.      28346,28346,0,28192,9,8154,0,8132,10,8127,0,28192,44,12211,12064,12064,12228,12212,
  79.      12084,12211,0,28192,6,28346,28346,0,28192,9,8115,7968,7968,7968,7985,0,7968,6,8115,
  80.      0,28192,44,12211,12064,12064,12228,12212,12083,12211,0,28192,6,28346,28346,0,28192,9,
  81.      8115,7968,7968,8180,0,7968,7,8115,0,28192,36,28448,0,28192,7,12211,12064,12064,
  82.      12228,12212,12082,12211,0,28192,6,28346,28346,0,28192,9,8115,7968,7968,8115,
  83.      7968,8056,7968,8036,8056,7968,7968,8115,0,28192,44,12211,12064,12064,
  84.      12228,12212,12081,12211,0,28192,6,28346,28346,0,28192,9,8115,7968,7968,8181,
  85.      0,7968,7,8115,0,28192,44,12211,12064,12064,12228,12249,12080,12211,0,28192,6,
  86.      28346,28346,28192,28192,9417,9421,9421,9403,28192,28192,28192,8115,7968,7984,0,7968,8,
  87.      8115,0,28192,12,0,24283,9,0,28192,23,12224,0,12228,5,12249,0,28192,6,28346,28346,28192,28192,
  88.      9402,28192,28192,9402,28192,28192,28192,8128,0,8132,10,8153,0,28192,12,24283,24096,
  89.      24288,24096,24102,24096,24298,24096,24283,0,28192,36,28346,28346,28192,28192,
  90.      9402,28192,28192,9402,0,28192,27,0,24283,9,0,28192,31,28428,0,28192,4,28346,28346,28192,28192,
  91.      9420,9421,9421,9418,0,9421,21,9403,0,28192,35,28174,28192,28192,28173,28192,28192,
  92.      28173,28192,28174,0,28192,6,28346,28346,28192,28192,9402,0,28192,24,9402,0,28192,4,
  93.      9417,0,9421,12,9403,0,28192,15,28174,28192,28192,28173,28192,28192,28174,28192,28192,
  94.      28173,0,28192,7,28346,28346,28192,28192,9402,0,28192,24,9402,0,28192,4,9402,0,28192,12,
  95.      9402,0,28192,13,28427,0,28192,18,28346,28346,28192,28192,9416,0,9421,24,9418,0,9421,4,
  96.      9418,0,9421,12,9404,0,28192,32,28346,28360,0,28365,78,28348
  97.    };
  98.    int EXAMPLE_size = 568;
  99.  
  100.     /* Pass your screen to showscreen as follows */
  101.  
  102.     showscreen (EXAMPLE_scr, EXAMPLE_size, EXAMPLE_vidmode);
  103.  
  104. }
  105.